package com.feicheng.controller.wx;


import com.alibaba.fastjson.JSONArray;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.service.IFProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cailongyang
 * @since 2022-01-10
 */
@RestController("/wx/category")
@RequestMapping("/wx/category")
public class CategoryController {

    @Autowired
    IFProductService productService;

    @GetMapping("/ids")
    public ResultInfo getCurrentCategoryIds(Integer categoryId) {
        return ResultInfo.success(productService.allCurrentCategoryIds(categoryId, new JSONArray()));
    }

    @GetMapping("/sub")
    public ResultInfo getSubCategory(Integer categoryId) {
        return ResultInfo.success(productService.getSubCategory(categoryId));
    }

    @GetMapping("/info")
    public ResultInfo getCategory(Integer categoryId) {
        return productService.getCategoryDetail(categoryId);
    }


}
